<template lang="html">
  <div class="el_box">
      <el-form v-model="ruleForm2" label-width="140px">

        <el-form-item label="期初配给">
          <el-input v-model="ruleForm2.obd_num"></el-input>
        </el-form-item>
        <el-form-item label="供应奖励金额">
          <el-input v-model="ruleForm2.obd_reward"></el-input>
        </el-form-item>

        <el-form-item label="申请结算时间段">
          <el-select v-model="ruleForm2.begin_cash_time" class="select_class" placeholder="开始时间">
            <el-option v-for="item,index in date" :label="item" :value="item"></el-option>
          </el-select>
          <span>号</span>
          <span>-</span>
          <el-select v-model="ruleForm2.end_cash_time" class="select_class" placeholder="结束时间">
            <el-option v-for="item,index in date" :label="item"  :value="item"></el-option>
          </el-select>
          <span>号</span>
        </el-form-item>


        <el-form-item label="申请结算最低金额">
          <el-input type="number" v-model="ruleForm2.min_money"></el-input>
        </el-form-item>

        <el-form-item>
          <el-button type="primary" @click="submitForm">提交</el-button>
        </el-form-item>
      </el-form>
  </div>
</template>

<script>
export default {
  data () {
    return {
      date: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31],
      ruleForm2: {
        begin_cash_time: '20',
        end_cash_time: '28',
      },
      string: '号'
    }
  },
  created () {
    this.$forceUpdate()
    this.ruleForm2.obd_num = 10

    this.$http2.getAgoInfo().then(res => {
      if (res.data.code == 1) {
        res.data.data.min_money = parseFloat(res.data.data.min_money)
        this.ruleForm2 = res.data.data
      } else {
        this.ruleForm2 = []
      }
    })
  },
  methods: {
    submitForm () {
      this.$http2.setSmParams({
        obd_num: this.ruleForm2.obd_num,
        obd_reward: this.ruleForm2.obd_reward,
        begin_cash_time: this.ruleForm2.begin_cash_time,
        end_cash_time: this.ruleForm2.end_cash_time,
        min_money: this.ruleForm2.min_money
      }).then(res => {
        if (res.data.code == 1) {
          this.$message.success(res.data.msg)
        } else {
          this.$message.error(res.data.msg)
        }
      })

    },


  }

}
</script>

<style lang="css" scoped>
.el_box {
  width: 600px;
  padding: 10px 10px 10px 30px;
  box-sizing: border-box;
}
.dateClass {
  width: 100%;
}
.select_class {
  width: 184px;
}
</style>
